package day04;

public class ForDemo {
    public static void main(String[] args) {
        //九九乘法表
        /*
        for (int a=1;a<=9;a++){
            for(int b=1;b<=a;b++){
                System.out.println(b+"*"+a+"="+a*b);
            }
        }
         */

        //累加
        int sum=0;
        for (int a =1;a<=100;a++){
            sum = sum + a;
        }
        System.out.println(sum);
        /*
                sum=0
       i=1      sum=1
       i=2      sum=1+2
       i=3      sum=1+2+3
       i=4      sum=1+2+3+4
       ...      sum=1+2+3+4+...
       i=99     sum=1+2+3+4+...+99
       i=100    sum=1+2+3+4+...+99+100
       i=101    false 跳出循环

         */


    //课上练习
    /*for(int num = 1;num <=9;num++){
        System.out.println(num+"*9="+num*9);
    }
    for(int num = 1;num<=9;num+=2){
        System.out.println(num+"*9="+num*9);
    }
    for (int num = 9;num>=1;num--){
        System.out.println(num+"*9="+num*9);
    }

     */

    }
}











